function Json() { // handles all json api calls
  
  // makes a json request, calls callback function passed
  this.getData = function(type, callbackFunction, id) {

    switch(type) {
    
      case "workspaces":
        $.ajax({type: "GET", url: "https://api.huddle.net/v1/json/workspaces/", dataType: "json", username: huddle.getUsername(), password: huddle.getPassword(), success: callbackFunction, complete: json.handleError});
        break;
    
      case "workspace":
        $.ajax({type: "GET", url: "https://api.huddle.net/v1/json/workspaces/" + id + "/items", dataType: "json", username: huddle.getUsername(), password: huddle.getPassword(), success: callbackFunction, complete: json.handleError});
        break;
        
      case "folder":
        $.ajax({type: "GET", url: "https://api.huddle.net/v1/json/folders/" + id + "/items", dataType: "json", username: huddle.getUsername(), password: huddle.getPassword(), success: callbackFunction, complete: json.handleError});
        break;
        
      case "file":
        $.ajax({type: "GET", url: "https://api.huddle.net/v1/json/files/" + id + "", dataType: "json", username: huddle.getUsername(), password: huddle.getPassword(), success: callbackFunction, complete: json.handleError});
        break;
        
      case "whatsnew":
        $.ajax({type: "GET", url: "https://api.huddle.net/v1/json/whats-new", dataType: "json", username: huddle.getUsername(), password: huddle.getPassword(), success: callbackFunction, complete: json.handleWhatsNewError});
        break;
        
      case "whatsnewworkspace":
        $.ajax({type: "GET", url: "https://api.huddle.net/v1/json/workspaces/" + id + "/whats-new", dataType: "json", username: huddle.getUsername(), password: huddle.getPassword(), success: callbackFunction, complete: json.handleWhatsNewError});
        break;
    
      default: // catch any errors in variables passed
        msgs.setError(1, "getData didn't find a match in switch for type", "Unable to obtain data from Huddle", 0);
        break;
    
    }
  
  }
  
  // handle an error, resetting login and displaying a message
  this.handleError = function(XMLHttpRequest, textStatus, errorThrown) {

    page.loadComplete();
  
    if (textStatus == "error") {
    
      huddle.wipe();
    
      page.displayPage("login", null);

      msgs.setError(2, "json.getData had an error with the jquery ajax call", "An error occured communicating with Huddle", 3000);

    }
  
  }
  
  // handles problem with what's new feed (don't want to reload the page)
  this.handleWhatsNewError = function(XMLHttpRequest, textStatus, errorThrown) {

    if (textStatus == "error") {
      
      msgs.setError(2, "json.getData had an error with the jquery ajax call, whats new cases", "An error occured obtaining the Whats New feed", 1000);
    
    }
  
  }
    
  // handle file download error
  this.handleFileDownload = function(XMLHttpRequest, textStatus, errorThrown) {

    if (textStatus == "error") {
      
      msgs.setError(2, "json.getData had an error with the jquery ajax call, download case", "An error occured downloading a file in the background", 1000);
    
    }
  
  }

}